<template>
  <div>
  </div>
</template>
<script>
export default {
  data() {
    return {}
  },
  created() {
    this.getid();
  },
  mounted() {
  },
  methods: {
    getUrlParms(name) {
      let reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
      let r = window.location.search.substr(1).match(reg);
      if (r != null)
        return unescape(r[2]);
      return null;
    },
    getid() {
      // let vm = this;
      // sessionStorage.setItem('areaId', "0000034");
      // sessionStorage.setItem('urseName', '张桢楠');
      // sessionStorage.setItem('abilityList', JSON.stringify(["edit", "downLoad"]));
      // sessionStorage.setItem('areaId', '0000011');
      // sessionStorage.setItem('urseName', '本道测试');
      // this.$axios.get('/api/area/' + '0000011')
      //   .then(res => {
      //     sessionStorage.setItem('imgUrl', '/api' + res.data.topIconPath);
      //     sessionStorage.setItem('areaId', '0000034');
      //     sessionStorage.setItem('urseName', '杨文斌');
      //     sessionStorage.setItem('userId', '00001');
      //     sessionStorage.setItem('siteId', 'songshan001');
      //     sessionStorage.setItem('currentPath', 'realTimeInformation');
      //     sessionStorage.setItem('abilityList', JSON.stringify(["edit", "downLoad"]));
      //     this.$router.push('/infraredCamera');
      //   })
      //   .catch(err => {
      //   }) 

      let vm = this;
      vm.$axios.post('/api/cilent/validate?key=' + vm.getUrlParms("id"))
        .then(res => {
          if (res.data.status == "success") {
            sessionStorage.setItem('areaId', res.data.data);
            sessionStorage.setItem('urseName', res.data.logInfo.zhName);
            sessionStorage.setItem('abilityList', JSON.stringify(["edit", "downLoad"]));
            sessionStorage.setItem('roles', res.data.logInfo.roles);
            vm.$axios.get('/api/area/' + res.data.data)
              .then(res => {
                sessionStorage.setItem('imgUrl', '/api' + res.data.topIconPath);
                vm.$router.push('/infraredCamera');
              })
              .catch(err => {
              }) 
          }
          if (res.data.status == "error") {
            alert(res.data.message)
          }
        })
        .catch(err => {
        })

    },
  }
}

</script>
<style scoped></style>
